package com.ds.infrastructure.hyperspace.container.flow.context;

import com.ds.infrastructure.hyperspace.common.flow.TargetNodeContext;
import com.ds.infrastructure.hyperspace.container.endpoint.destination.TargetEndpointNode;

/**
 * @author  Weishaoying
 */
public class HyperspaceTargetNodeContext implements TargetNodeContext {

    private final TargetEndpointNode targetEndpointNode;

    private int effectiveWeight;

    private int currentWeight;

    public HyperspaceTargetNodeContext(TargetEndpointNode targetEndpointNode) {
        this.targetEndpointNode = targetEndpointNode;
        this.effectiveWeight = targetEndpointNode.getNodeConfig().getProtocolConfig().getWeight();
    }

    @Override
    public int getConfigWeight() {
        return targetEndpointNode.getNodeConfig().getProtocolConfig().getWeight();
    }

    @Override
    public int getEffectiveWeight() {
        return effectiveWeight;
    }

    @Override
    public int getCurrentWeight() {
        return currentWeight;
    }

    @Override
    public void setEffectiveWeight(int effectiveWeight) {
        this.effectiveWeight = effectiveWeight;
    }

    @Override
    public void setCurrentWeight(int currentWeight) {
        this.currentWeight = currentWeight;
    }
}
